package com.example.ross.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 设置Swagger
 * @author RossZhang
 * @version 1.0
 * @date 2020/7/16
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    /**
     *  配置Swagger信息
     *  http://localhost:8080/swagger-ui.html  请求路径
     */

    @Bean
    public Docket createDocketApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.ross"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("学习系统 项目 API 文档")
                        .description("演示Springboot整合Swagger")
                        .version("1.0")
                        .contact(new Contact("CKF","http://www.baidu.com","143@qq.com"))
                        .license("The Apache License")
                        .licenseUrl("https://www.cnblogs.com/zhunong/")
                        .build());
    }
}
